import { inspectTypeList as inspectTypeListRaw } from '@/utils/baseData'

// 增加 '随机楼栋' 项
const inspectTypeList = JSON.parse(JSON.stringify(inspectTypeListRaw))
inspectTypeList.map(i => i.scoreTypeList.unshift({ label: '随机楼栋', value: 'sjld' }))
export { inspectTypeList }

// 通过过程类型获取检查项的枚举，用于展示 label
export const getScoreTypeEnum = processType => {
  const item = inspectTypeList.find(i => i.processType === processType)
  if (!item) return null
  return item.scoreTypeList.reduce((o, i) => {
    o[i.value] = i.label
    i.children && i.children.map(j => (o[j.value] = j.label))
    return o
  }, {})
}
